<template>
    <div class="addFromBoard">
        <el-dialog :visible.sync="addFromBoardVisible" width="400px" @close='handleClose' :close-on-click-modal='false'>
            <div class="dialogBody">
               <el-form :model="boardForm" ref="boardForm" label-width="80px" size="mini">
                    <el-form-item label="工艺路线" prop="gylx" style="margin:10px 0 0">
                        <search-input :url="'/base/pr_other'" :placeholder="'请选择'" :prop="'boardGylx'"
                            @handleChange='handleChange' ref="searchInput">
                        </search-input>
                    </el-form-item>
                </el-form>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button size="mini" @click='addFromBoardVisible = false'>取 消</el-button>
                <el-button type="primary" size="mini" @click="confirmAdd">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
    import searchInput from '../searchInput.vue'
    export default {
        data() {
            return {
                boardForm: {
                    gylx: ''
                },
                addFromBoardVisible: false,
            }
        },
        components:{
            searchInput
        },
        methods: {
            add(payload) {
                this.addFromBoardVisible = true
            },
            handleChange(v){
                this.boardForm.gylx = v.v
            },
            handleClose() {
                this.$refs.searchInput.reset()
            },
            //确认
            confirmAdd() {
                if(this.boardForm.gylx.length == ''){
                    this.utils.showMsg('正在查询工艺路线数据，请稍候', 'warning')
                    return
                }
                this.$emit('emitAddFromBoard',this.boardForm.gylx)
                this.addFromBoardVisible = false
            }
        }
    }
</script>

<style lang="less" scoped>
    .addFromBoard {

        /deep/ .el-dialog__footer {
            text-align: center;

            .el-button {
                padding: 7px 35px;
            }
        }
    }
</style>